#!/bin/bash
BASENAME=${1}
DATE=${2}
MESSAGE="LaTeX Warning:.* Rerun"
while [ 1 ]; do
	pdflatex \\def\\pdfdate{${DATE}} \\input{${BASENAME}}
	grep "${MESSAGE}" ${BASENAME}.log &>/dev/null
	if [ $? == 1 ]; then break; fi
done
